<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        \App\Console\Commands\My_schedule::class,
        \App\Console\Commands\Progress::class,
        \App\Console\Commands\Make_jiaxiao_notice::class,
        \App\Console\Commands\Auto_make_jiaxiao_notice::class,
        \App\Console\Commands\Credits::class,
        \App\Console\Commands\MonthSquad::class
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        //定时在每天凌晨2点根据课表创建待办
        $schedule->command('auto_make_schedules')->dailyAt('02:00');
        
        //定时在每月1号凌晨2点为所有班主任创建所有班级的进度确认
        $schedule->command('progress')->monthlyOn('1','02:00');

        //定时在每周一凌晨2点为当周所有班级生成一条家校
        $schedule->command('make_jiaxiao_notice')->weeklyOn('1','02:00');

         //定时在每周三凌晨2点为当周所有班级生成一条家校
        $schedule->command('auto_make_jiaxiao_notice')->weeklyOn('3','02:00');

        //定时在每月15号凌晨2点为所有班级创建学分表
        $schedule->command('credits')->monthlyOn('15','02:00');
        //每周三凌晨2点生成两周前的班级周表
        $schedule->command('monthsquad')->weeklyOn('3','02:00');
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
